home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / lib / mozilla-firefox / include / js / fdlibm.h next >
C/C++ Source or Header  |  2006-05-08  |  8KB  |  274 lines

  1. /* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  2.  *
  3.  * ***** BEGIN LICENSE BLOCK *****
  4.  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  5.  *
  6.  * The contents of this file are subject to the Mozilla Public License Version
  7.  * 1.1 (the "License"); you may not use this file except in compliance with
  8.  * the License. You may obtain a copy of the License at
  9.  * http://www.mozilla.org/MPL/
  10.  *
  11.  * Software distributed under the License is distributed on an "AS IS" basis,
  12.  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  13.  * for the specific language governing rights and limitations under the
  14.  * License.
  15.  *
  16.  * The Original Code is Mozilla Communicator client code, released
  17.  * March 31, 1998.
  18.  *
  19.  * The Initial Developer of the Original Code is
  20.  * Sun Microsystems, Inc.
  21.  * Portions created by the Initial Developer are Copyright (C) 1998
  22.  * the Initial Developer. All Rights Reserved.
  23.  *
  24.  * Contributor(s):
  25.  *
  26.  * Alternatively, the contents of this file may be used under the terms of
  27.  * either of the GNU General Public License Version 2 or later (the "GPL"),
  28.  * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  29.  * in which case the provisions of the GPL or the LGPL are applicable instead
  30.  * of those above. If you wish to allow use of your version of this file only
  31.  * under the terms of either the GPL or the LGPL, and not to allow others to
  32.  * use your version of this file under the terms of the MPL, indicate your
  33.  * decision by deleting the provisions above and replace them with the notice
  34.  * and other provisions required by the GPL or the LGPL. If you do not delete
  35.  * the provisions above, a recipient may use your version of this file under
  36.  * the terms of any one of the MPL, the GPL or the LGPL.
  37.  *
  38.  * ***** END LICENSE BLOCK ***** */
  39.  
  40. /* @(#)fdlibm.h 1.5 95/01/18 */
  41. /*
  42.  * ====================================================
  43.  * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
  44.  *
  45.  * Developed at SunSoft, a Sun Microsystems, Inc. business.
  46.  * Permission to use, copy, modify, and distribute this
  47.  * software is freely granted, provided that this notice 
  48.  * is preserved.
  49.  * ====================================================
  50.  */
  51.  
  52. /* Modified defines start here.. */
  53. #undef __LITTLE_ENDIAN
  54.  
  55. #ifdef _WIN32
  56. #define huge myhuge
  57. #define __LITTLE_ENDIAN
  58. #endif
  59.  
  60. #ifdef XP_OS2
  61. #define __LITTLE_ENDIAN
  62. #endif
  63.  
  64. #if defined(linux) && (defined(__i386__) || defined(__x86_64__) || defined(__ia64) || defined(__MIPSEL))
  65. #define __LITTLE_ENDIAN
  66. #endif
  67.  
  68. /* End here. The rest is the standard file. */
  69.  
  70. #ifdef SOLARIS    /* special setup for Sun test regime */
  71. #if defined(i386) || defined(i486) || \
  72.     defined(intel) || defined(x86) || defined(i86pc)
  73. #define __LITTLE_ENDIAN
  74. #endif
  75. #endif
  76.  
  77. typedef union {
  78. #ifdef __LITTLE_ENDIAN
  79.     struct { int lo, hi; } ints;
  80. #else
  81.     struct { int hi, lo; } ints;
  82. #endif
  83.     double d;
  84. } fd_twoints;
  85.  
  86. #define __HI(x) x.ints.hi
  87. #define __LO(x) x.ints.lo
  88.  
  89. #undef __P
  90. #ifdef __STDC__
  91. #define    __P(p)    p
  92. #else
  93. #define    __P(p)    ()
  94. #endif
  95.  
  96. /*
  97.  * ANSI/POSIX
  98.  */
  99.  
  100. extern int signgam;
  101.  
  102. #define    MAXFLOAT    ((float)3.40282346638528860e+38)
  103.  
  104. enum fdversion {fdlibm_ieee = -1, fdlibm_svid, fdlibm_xopen, fdlibm_posix};
  105.  
  106. #define _LIB_VERSION_TYPE enum fdversion
  107. #define _LIB_VERSION _fdlib_version  
  108.  
  109. /* if global variable _LIB_VERSION is not desirable, one may 
  110.  * change the following to be a constant by: 
  111.  *    #define _LIB_VERSION_TYPE const enum version
  112.  * In that case, after one initializes the value _LIB_VERSION (see
  113.  * s_lib_version.c) during compile time, it cannot be modified
  114.  * in the middle of a program
  115.  */ 
  116. extern  _LIB_VERSION_TYPE  _LIB_VERSION;
  117.  
  118. #define _IEEE_  fdlibm_ieee
  119. #define _SVID_  fdlibm_svid
  120. #define _XOPEN_ fdlibm_xopen
  121. #define _POSIX_ fdlibm_posix
  122.  
  123. struct exception {
  124.     int type;
  125.     char *name;
  126.     double arg1;
  127.     double arg2;
  128.     double retval;
  129. };
  130.  
  131. #define    HUGE        MAXFLOAT
  132.  
  133. /* 
  134.  * set X_TLOSS = pi*2**52, which is possibly defined in <values.h>
  135.  * (one may replace the following line by "#include <values.h>")
  136.  */
  137.  
  138. #define X_TLOSS        1.41484755040568800000e+16 
  139.  
  140. #define    DOMAIN        1
  141. #define    SING        2
  142. #define    OVERFLOW    3
  143. #define    UNDERFLOW    4
  144. #define    TLOSS        5
  145. #define    PLOSS        6
  146.  
  147. /*
  148.  * ANSI/POSIX
  149.  */
  150.  
  151. extern double fd_acos __P((double));
  152. extern double fd_asin __P((double));
  153. extern double fd_atan __P((double));
  154. extern double fd_atan2 __P((double, double));
  155. extern double fd_cos __P((double));
  156. extern double fd_sin __P((double));
  157. extern double fd_tan __P((double));
  158.  
  159. extern double fd_cosh __P((double));
  160. extern double fd_sinh __P((double));
  161. extern double fd_tanh __P((double));
  162.  
  163. extern double fd_exp __P((double));
  164. extern double fd_frexp __P((double, int *));
  165. extern double fd_ldexp __P((double, int));
  166. extern double fd_log __P((double));
  167. extern double fd_log10 __P((double));
  168. extern double fd_modf __P((double, double *));
  169.  
  170. extern double fd_pow __P((double, double));
  171. extern double fd_sqrt __P((double));
  172.  
  173. extern double fd_ceil __P((double));
  174. extern double fd_fabs __P((double));
  175. extern double fd_floor __P((double));
  176. extern double fd_fmod __P((double, double));
  177.  
  178. extern double fd_erf __P((double));
  179. extern double fd_erfc __P((double));
  180. extern double fd_gamma __P((double));
  181. extern double fd_hypot __P((double, double));
  182. extern int fd_isnan __P((double));
  183. extern int fd_finite __P((double));
  184. extern double fd_j0 __P((double));
  185. extern double fd_j1 __P((double));
  186. extern double fd_jn __P((int, double));
  187. extern double fd_lgamma __P((double));
  188. extern double fd_y0 __P((double));
  189. extern double fd_y1 __P((double));
  190. extern double fd_yn __P((int, double));
  191.  
  192. extern double fd_acosh __P((double));
  193. extern double fd_asinh __P((double));
  194. extern double fd_atanh __P((double));
  195. extern double fd_cbrt __P((double));
  196. extern double fd_logb __P((double));
  197. extern double fd_nextafter __P((double, double));
  198. extern double fd_remainder __P((double, double));
  199. #ifdef _SCALB_INT
  200. extern double fd_scalb __P((double, int));
  201. #else
  202. extern double fd_scalb __P((double, double));
  203. #endif
  204.  
  205. extern int fd_matherr __P((struct exception *));
  206.  
  207. /*
  208.  * IEEE Test Vector
  209.  */
  210. extern double significand __P((double));
  211.  
  212. /*
  213.  * Functions callable from C, intended to support IEEE arithmetic.
  214.  */
  215. extern double fd_copysign __P((double, double));
  216. extern int fd_ilogb __P((double));
  217. extern double fd_rint __P((double));
  218. extern double fd_scalbn __P((double, int));
  219.  
  220. /*
  221.  * BSD math library entry points
  222.  */
  223. extern double fd_expm1 __P((double));
  224. extern double fd_log1p __P((double));
  225.  
  226. /*
  227.  * Reentrant version of gamma & lgamma; passes signgam back by reference
  228.  * as the second argument; user must allocate space for signgam.
  229.  */
  230. #ifdef _REENTRANT
  231. extern double gamma_r __P((double, int *));
  232. extern double lgamma_r __P((double, int *));
  233. #endif    /* _REENTRANT */
  234.  
  235. /* ieee style elementary functions */
  236. extern double __ieee754_sqrt __P((double));            
  237. extern double __ieee754_acos __P((double));            
  238. extern double __ieee754_acosh __P((double));            
  239. extern double __ieee754_log __P((double));            
  240. extern double __ieee754_atanh __P((double));            
  241. extern double __ieee754_asin __P((double));            
  242. extern double __ieee754_atan2 __P((double,double));            
  243. extern double __ieee754_exp __P((double));
  244. extern double __ieee754_cosh __P((double));
  245. extern double __ieee754_fmod __P((double,double));
  246. extern double __ieee754_pow __P((double,double));
  247. extern double __ieee754_lgamma_r __P((double,int *));
  248. extern double __ieee754_gamma_r __P((double,int *));
  249. extern double __ieee754_lgamma __P((double));
  250. extern double __ieee754_gamma __P((double));
  251. extern double __ieee754_log10 __P((double));
  252. extern double __ieee754_sinh __P((double));
  253. extern double __ieee754_hypot __P((double,double));
  254. extern double __ieee754_j0 __P((double));
  255. extern double __ieee754_j1 __P((double));
  256. extern double __ieee754_y0 __P((double));
  257. extern double __ieee754_y1 __P((double));
  258. extern double __ieee754_jn __P((int,double));
  259. extern double __ieee754_yn __P((int,double));
  260. extern double __ieee754_remainder __P((double,double));
  261. extern int    __ieee754_rem_pio2 __P((double,double*));
  262. #ifdef _SCALB_INT
  263. extern double __ieee754_scalb __P((double,int));
  264. #else
  265. extern double __ieee754_scalb __P((double,double));
  266. #endif
  267.  
  268. /* fdlibm kernel function */
  269. extern double __kernel_standard __P((double,double,int,int*));
  270. extern double __kernel_sin __P((double,double,int));
  271. extern double __kernel_cos __P((double,double));
  272. extern double __kernel_tan __P((double,double,int));
  273. extern int    __kernel_rem_pio2 __P((double*,double*,int,int,int,const int*));
  274.